package suites.integration {
	import org.flexunit.asserts.assertNotNull;
	import org.splink.resource.ResourceProvider;
	import org.splink.library.queue.QEvent;

	/**
	 * <code>AssetTest</code> assumes that there is an assets.swf within the sample/assets folder
	 * which contains one asset with the class name <code>SplinkAsset</code>
	 * 
	 * @author Max Kugland
	 */
	public class AssetTest extends AbstractIntegrationTest {
		private static const SplinkAsset : String = "SplinkAsset";

		[Test (async)]
		public function singleAssetDefaultLocale() : void {
			handleAsync(1000);
			
			var xml : XML = <resourcebundles defaultLocale="de_DE">
								<resourcebundle locale="de_DE">
									<assets path="../sample/assets/">
										<asset id="sample" src="assets.swf" filesize="16383" />
									</assets>
								</resourcebundle>
							</resourcebundles>;
			
			createProcessor(xml, function(e : QEvent) : void {
				assertNotNull(ResourceProvider.instance().getAssetById(SplinkAsset));
			}).start();
		}
		
		[Test (async)]
		public function singleAssetSelectedLocale() : void {
			handleAsync(1000);
			
			var xml : XML = <resourcebundles defaultLocale="de_DE">
								<resourcebundle locale="de_DE">
									<assets path="../sample/assets/">
										<asset id="sample" src="assets.swf" filesize="16383" />
									</assets>
								</resourcebundle>
								<resourcebundle locale="en_EN">
									<assets path="../sample/assets/">
										<asset id="sample" src="assets.swf" filesize="16383" />
									</assets>
								</resourcebundle>
							</resourcebundles>;
			
			createProcessor(xml, function(e : QEvent) : void {
				assertNotNull(ResourceProvider.instance().getAssetById(SplinkAsset));
			}, "en_EN").start();
			
		}
		
		
	}
}
